﻿using CommonAPI.Data.Model;
using Newtonsoft.Json;
using System.Text;

namespace CommonAPI.Data.Resources;

public static class ResourceTool {
    /// <summary>
    /// 中文名
    /// </summary>
    public static readonly IReadOnlyList<string> ChineseNames = Resource.ChineseNames.Split(' ', StringSplitOptions.RemoveEmptyEntries);
    /// <summary>
    /// 中国行政规划
    /// </summary>
    public static readonly IReadOnlyList<CityItem> ChinaRegions = JsonConvert
        .DeserializeObject<IList<CityItemInternal>>(Encoding.UTF8.GetString(Resource.ChinaRegion))!
        .Select(item => item.ToCityItem())
        .ToList();
    /// <summary>
    /// 英文单词
    /// </summary>
    public static readonly IReadOnlyList<string> EnglishWords = Resource.EnglishWords.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
    /// <summary>
    /// 头像
    /// </summary>
    public static readonly IReadOnlyList<string> Avatars = Resource.Avatars.Split('\n', StringSplitOptions.RemoveEmptyEntries | StringSplitOptions.TrimEntries);
}
